package com.example.shushiyunsst.fragment.main.mine.child

import android.os.Bundle
import android.view.View
import android.webkit.WebView
import android.widget.TextView
import androidx.appcompat.widget.Toolbar
import com.example.library_common.base.BaseFragmentEx
import com.example.shushiyunsst.R
import com.example.shushiyunsst.fragment.main.mine.child.bean.HelperCenterBean

class HelperCenterSecondFragment : BaseFragmentEx() {

    companion object {
        fun newInstance(bean: HelperCenterBean): HelperCenterSecondFragment {
            val args = Bundle()
            args.putSerializable("bean", bean)
            val fragment = HelperCenterSecondFragment()
            fragment.arguments = args
            return fragment
        }
    }

    private var bean: HelperCenterBean? = null

    private lateinit var mToolbar: Toolbar

    private lateinit var mWebView: WebView

    private lateinit var titleTv: TextView

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        bean = arguments?.getSerializable("bean") as HelperCenterBean
    }

    override fun getLayoutId(): Any {
        return R.layout.helper_center_second_fragment
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        mToolbar = view.findViewById(R.id.mToolbar)
        mToolbar.setNavigationOnClickListener { onBackPressedSupport() }

        mWebView = view.findViewById(R.id.mWebView)
        titleTv = view.findViewById(R.id.titleTv)

        titleTv.text=bean?.title

        mWebView.loadData(bean?.content?:"", "text/html; charset=UTF-8", null)
    }

}